/* 全局样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 页面基础样式 */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 20px;
    min-height: 100vh;
}

/* 头部样式 */
.header {
    text-align: center;
    margin-bottom: 30px;
    color: white;
}

.header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.header p {
    font-size: 1.2em;
    opacity: 0.9;
}

/* 主内容区域布局 */
.main-content {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 30px;
    margin-bottom: 20px;
    min-height: 500px;
    align-items: start;
}

/* 帧缓冲区容器 */
.frame-buffer-container {
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    min-height: 400px;
    max-height: 80vh;
    overflow: hidden;
}

.frame-buffer-container h2 {
    margin-bottom: 15px;
    color: #4a5568;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 10px;
}

/* 控制面板 */
.controls {
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.controls h2 {
    margin-bottom: 15px;
    color: #4a5568;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 10px;
}

/* 按钮组样式 */
.button-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.btn {
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #e2e8f0;
    color: #4a5568;
}

.btn-secondary:hover {
    background: #cbd5e0;
    transform: translateY(-2px);
}

/* 金币按钮样式 */
.btn-coin {
    background: linear-gradient(135deg, #ffd700 0%, #ffb347 100%);
    color: #8b4513;
    border: 2px solid #daa520;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    box-shadow: 0 4px 8px rgba(218, 165, 32, 0.3);
}

.btn-coin:hover {
    background: linear-gradient(135deg, #ffb347 0%, #ffd700 100%);
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 12px rgba(218, 165, 32, 0.4);
}

.btn-coin:active {
    transform: translateY(0) scale(0.98);
    box-shadow: 0 2px 4px rgba(218, 165, 32, 0.3);
}

.coin-icon {
    font-size: 1.2em;
    filter: drop-shadow(1px 1px 2px rgba(0,0,0,0.3));
}

.coins-value {
    font-family: 'Courier New', monospace;
    font-weight: 700;
    font-size: 14px;
    color: #8b4513;
    text-shadow: 0 1px 2px rgba(255,255,255,0.5);
}

/* 状态面板 */
.status-panel {
    background: #f7fafc;
    border-radius: 8px;
    padding: 15px;
    margin-top: 20px;
}

.status-link {
    color: #667eea;
    text-decoration: none;
    transition: color 0.3s ease;
}

.status-link:hover {
    color: #764ba2;
    text-decoration: underline;
}

.status-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    padding: 5px 0;
    border-bottom: 1px solid #e2e8f0;
}

.status-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.status-label {
    font-weight: 600;
    color: #4a5568;
}

.status-value {
    font-family: 'Courier New', monospace;
    color: #2d3748;
}

/* 页脚样式 */
.footer {
    text-align: center;
    margin-top: 30px;
    color: white;
    opacity: 0.8;
}

/* 帧缓冲区特定样式 */
.frame-buffer {
    background: #1a202c;
    border-radius: 8px;
    padding: 15px;
    overflow: auto;
    flex: 1;
    min-height: 0;
    max-height: none;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    border: 1px solid #ddd;
    position: relative;
}

.frame-buffer table {
    border-collapse: collapse;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    line-height: 1;
    margin: 0;
    table-layout: fixed;
    width: auto;
    max-width: 100%;
    border-spacing: 0;
}

.frame-buffer td {
    width: 20px;
    height: 20px;
    min-width: 20px;
    min-height: 20px;
    text-align: center;
    border: 1px solid #2d3748;
    padding: 0;
    color: #e2e8f0;
    font-size: 12px;
    line-height: 20px;
    box-sizing: border-box;
    overflow: hidden;
    user-select: none;
    white-space: nowrap;
}

.loading {
    text-align: center;
    padding: 40px;
    color: #718096;
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr 300px;
        height: calc(100vh - 180px);
        gap: 20px;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .main-content {
        grid-template-columns: 1fr;
        height: auto;
        min-height: auto;
        gap: 20px;
    }
    
    .header h1 {
        font-size: 2em;
    }
    
    .frame-buffer {
        height: 400px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
    }
    
    .header h1 {
        font-size: 1.8em;
    }
    
    .frame-buffer {
        height: 300px;
        padding: 10px;
    }
}

/* 汇编代码输入框样式 */
#asmCode {
    font-family: 'Courier New', monospace;
    font-size: 14px;
    resize: vertical;
}

#asmCode:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

#asmStatus {
    min-height: 20px;
}

/* 删除重复的.frame-buffer样式定义 */

/* 矩形选择相关样式 */
.selected {
    background-color: #4dabf7 !important;
    color: white !important;
}

.selection-box {
    position: absolute;
    background-color: rgba(77, 171, 247, 0.3);
    border: 2px solid #4dabf7;
    pointer-events: none;
    z-index: 10;
    display: none;
}